import React from 'react'
import ReactDOM from 'react-dom'
import zhCN from 'antd/lib/locale/zh_CN';
import {ConfigProvider} from 'antd'
import {BrowserRouter as Router, Redirect, Route, Switch} from 'react-router-dom'
import { Provider } from 'react-redux'
import store from './store'
import App from './App.jsx'
import {whiteList} from './routes'

import 'antd/dist/antd.less'

import './untils/permission'


ReactDOM.render(
  <Provider store={store}>
    <Router>
  <ConfigProvider locale={zhCN}>
    <Switch>
    <Redirect to="/admin" from="/" exact />
      {
        whiteList.map(route => (
          <Route key={route.path} path={route.path} component={route.component} />
        ))
         
      }
      <Route path="/admin" component={App} />
      <Redirect to="/404" />
    </Switch>
  </ConfigProvider>
  </Router>
  </Provider>,
  document.getElementById('root')
)